package cn.xzqwjw.taskmanager.domain.pojo;

import cn.xzqwjw.taskmanager.common.validator.ValidGroupUpdate;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author rush
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class SysConfig extends Model<SysConfig> implements Serializable {

  @TableField(exist = false)
  private static final long serialVersionUID = 1L;

  @Override
  public Serializable pkVal() {
    return this.id;
  }

  @TableId(value = "id", type = IdType.AUTO)
  @NotNull(message = "id不能为空", groups = ValidGroupUpdate.class)
  private Integer id;

  @Length(max = 30, message = "tag 最多 {max} 个字符")
  private String tag;

  @Length(max = 100, message = "label 最多 {max} 个字符")
  private String label;

  @Length(max = 300, message = "value 最多 {max} 个字符")
  private String value;

  @Length(max = 500, message = "remark 最多 {max} 个字符")
  private String remark;

  /**
   * 是否是系统变量，如果是，表示这个值不能改变量名，只能改值
   */
  private Boolean flagSystem;

}
